import { aiMap, AiProduct } from './AiProduct';
import { claude2Product } from '../claude2';
import { HttpException, HttpStatus } from '@nestjs/common';

const aiMap: aiMap = {
  claude2: claude2Product,
};
export class AiFactory {
  constructor(private modelName: string) {}
  public async getAi(): Promise<AiProduct> {
    if (!this.modelName)
      throw new HttpException('modelName is undefined', HttpStatus.BAD_REQUEST);
    const ai = new aiMap[this.modelName]();
    if (ai) {
      return ai;
    } else {
      throw new HttpException('AI模型不存在', HttpStatus.BAD_REQUEST);
    }
  }
}
